package com.litongjava.jfina.undertow.servet.listener;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class Test01ServletContextLocalListener implements ServletContextListener {
  public Test01ServletContextLocalListener() {
    log.info("init");
  }

  public void contextInitialized(ServletContextEvent sce) {
    log.info("set _name");
    sce.getServletContext().setAttribute("_name", "aka");
  }

  public void contextDestroyed(ServletContextEvent sce) {
    Object attribute = sce.getServletContext().getAttribute("_name");
    log.info("get _name:{}", attribute);
  }
}